import { request } from '../request';

export function fetchLogin(UserName, Pwd, isSupplier) {
  //登录
  return request({
    url: '/api/user/Login',
    method: 'post',
    data: {
      UserName,
      Pwd,
      isSupplier,
    }
  });
}

export function fetchShopSeach(data) {
  //获取店铺
  return request({
    url: '/api/UserShop/Seach',
    method: 'post',
    data
  });
}

export function fetchGetCurrency(params){
  //获取汇率
  return request({ url: '/api/currency/getcurrencylist', params });
}

export function fetchGetWarehourse(){
  //获取仓库
  return request({ url: '/api/Product/GetSorage' });
}

export function fetchGetLogisticsChannel(params){
  //获取物流渠道
  return request({ url: '/api/usershop/getlogisticschannel', params });
}

export function fetchSetStorage(data){
  // 设置店铺绑定仓库
  return request({
    url: '/api/UserShop/SetStorage',
    method: 'post',
    data
  });
}

export function fetchSaveLogsChannel(data){
  // 设置物流渠道
  return request({
    url: '/api/usershop/setlogisticschannel',
    method: 'post',
    data
  });
}


export function fetchGetOrders(params){
  //获取订单
  return request({ url: '/api/Orders/Search', params });
}

export function fetchGetUserInfo() {
  return request({ url: '/auth/getUserInfo' });
}

export function fetchRefreshToken(refreshToken) {
  return request({
    url: '/auth/refreshToken',
    method: 'post',
    data: {
      refreshToken
    }
  });
}

export function fetchGetConstantRoutes() {
  return request({ url: '/route/getConstantRoutes' });
}

export function fetchGetUserRoutes() {
  return request({ url: '/route/getUserRoutes' });
}

export function fetchIsRouteExist(routeName) {
  return request({ url: '/route/isRouteExist', params: { routeName } });
}